import java.util.Arrays;

public class t468 {
    public static void main(String[] args) {
        String queryIP = "12..33.4";
        String str = validIPAddress(queryIP);
        System.out.println(str);
    }


    public static String validIPAddress(String queryIP) {
        if(queryIP.equals("")||queryIP.charAt(queryIP.length()-1) ==':' || queryIP.charAt(queryIP.length()-1) =='.'){
            return "Neither";
        }
        String arr[] = queryIP.split("[:.]");
        System.out.println(Arrays.toString(arr));
        if (arr.length != 4 && arr.length != 8) {
            return "Neither";
        } else {
            if (arr.length == 4) {
                for (int i = 0; i < arr.length; i++) {
                    String s = arr[i];
                    if (s.equals("")|| (s.length()>1&&s.charAt(0) == '0') || s.length() > 4) {
                        return "Neither";
                    } else {
                        for (int j = 0; j < s.length(); j++) {
                            if (s.charAt(j) > '9' || s.charAt(j) < '0') {
                                return "Neither";
                            }
                        }
                        if (Integer.parseInt(s) > 255) {
                            return "Neither";
                        }
                    }
                }
                return "IPv4";
            } else if
            (is_Six(arr)) {
                return "IPv6";
            } else {
                return "Neither";
            }
        }
    }

    public static boolean is_Six(String arr[]) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i].equals("")||arr[i].length() > 4 || arr[i].length() < 1) {
                return false;
            } else {
                char brr[] = arr[i].toCharArray();
                for (int j = 0; j < brr.length; j++) {
                    if ((brr[j] >= '0' && brr[j] <= '9') || (brr[j] >= 'a' && brr[j] <= 'f') || (brr[j] >= 'A' && brr[j] <= 'F')) {
                        continue;
                    } else {
                        return false;
                    }
                }
            }
        }
        return true;
    }
}
